﻿
(function () {
    appModule.controller('tenant.views.writerinformation.createOrEditWriterInformation', [
        '$scope', '$uibModalInstance', 'abp.services.app.writerInformation','writerInformationId',
        function ($scope, $uibModalInstance, writerInformationService,writerInformationId) {
            var vm = this;
            
            vm.saving = false;
            vm.writerInformation = null;

            vm.save = function () {
                vm.saving = true;
                writerInformationService.createOrUpdateWriterInformation({writerInformation:vm.writerInformation}).success(function () {
                    abp.notify.info(app.localize('SavedSuccessfully'));
                    $uibModalInstance.close();
                }).finally(function () {
                    vm.saving = false;
                });
            };

            vm.cancel = function () {
                $uibModalInstance.dismiss();
            };
            function init() {
                writerInformationService.getWriterInformationForEdit({
                    id: writerInformationId
                }).success(function (result) {
                    vm.writerInformation = result.writerInformation;
                });
            }

            init();
        }
    ]);
})();
